<!DOCTYPE HTML><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">	
<title><? echo $title ?></title>
<? require("lib.php"); ?>
</head>
<body>
<div class="content-box"><!-- Start Content Box -->
    <div class="content-box-header">
        <h3><? echo $title ?></h3>
        <div class="clear"></div>
    </div> <!-- End .content-box-header -->
    <div class="content-box-content">
<?
  switch ($do) {
    case "add":
    	add();
    	break;
	case "update":
		update($info);
		break;
	case "delete":
		delete($id);
		break;
	case "flip":
		flip($id);
		break;
    default:
		show_info($info);
  }
 ?>
<? function show_box($row, $iseditmode, $isadd){ 
	global $id, $cateid, $baseurl, $h, $url, $page, $title, $currency_sign, $currency_code;
?>
<table width="99%" cellspacing="0" cellpadding="3" class="mbox">
  <tr class="th"><td class="thtitle" width="148" align="right"><? echo $title ?></td><td>
  	<?
  	$gender='-';
  	if($row['gender']==1)$gender=ROOT_MALE;
  	if($row['gender']==2)$gender=ROOT_FEMALE;
  	echo $h->hidden('id', $row["id"]);
  	echo $h->hidden('page', $page);
  	echo $h->hidden('cateid', $cateid); ?></td></tr>
  <tr><td class="l"><?=ROOT_FULLNAME?></td><td><? echo $row['first_name'].' '.$row['last_name']; ?></td></tr>
  <tr><td class="l"><?=ROOT_GENDER?></td><td><? echo $gender ?></td></tr>
  <tr><td class="l"><?=ROOT_NICKNAME?></td><td><? echo $row['nickname'] ?></td></tr>
  <tr><td class="l"><?=ROOT_EMAIL?></td><td><? echo $row['email'] ?></td></tr>
  <tr><td class="l"><?=ROOT_PHONE?></td><td><? echo $row['phone'] ?></td></tr>
  <tr><td class="l"><?=ROOT_MOBILE?></td><td><? echo $row['mobile'] ?></td></tr>
  <tr><td class="l"><?=ROOT_USABLE_POINT?></td><td><? echo $row['usable_point'] ?></td></tr>
  <tr><td class="l"><?=ROOT_TOTAL_POINT?></td><td><? echo $row['accumulated_point'] ?></td></tr>
    <tr><td class="l">钱包余额</td><td><? echo $currency_code.' '.$row['usable_balance'].' '.$currency_sign ?></td></tr>
  <tr><td class="l"><?=ROOT_LAST_LOGIN_TIME?></td><td><? echo $row['last_login_time'] ?></td></tr>
  <tr><td class="l"><?=ROOT_LOGIN_COUNT?></td><td><? echo $row['login_count'] ?></td></tr>
  <tr><td class="l"><?=ROOT_REGISTRATION_TIME?></td><td><? echo $row['created_time'] ?></td></tr>
  
  <tr><td class="l"> </td><td><br><? $h->submit('save', '&nbsp; '.ROOT_SAVE.' &nbsp;', $iseditmode==1?'':'hide') ?>&nbsp; <a onClick="history.go(-1)">[ <?=ROOT_BACK?> ]</a><br><br></td></tr>
</table>
<? } ?>
<? function show_boxes($result){ 
	global $pages, $cateid, $cate, $baseurl, $page, $h, $s, $url, $grade, $lang, $currency_sign;
	$tem=$grade->get_rows(32);
	$arr_grade=array();
	foreach($tem as $val){ $arr_grade[$val['level']]=$val; }
	$str= '<table width="99%" class="mlist"><tr>';  // 搜索
	$str.= '<td><form action="'.$url.'.php" method="get"><input placeholder="'.ROOT_SEARCH_BY_FULLNAME_NICKNAME_EMAIL_PHONE_MOBILE.'" name="s" class="g" value="'.$s.'" /> &nbsp; <input class="button_blue" type="submit" value=" '.ROOT_SEARCH.' " /></form></td></tr></table>';
	$str.= '<table width="99%" cellspacing="0" cellpadding="3" class="mlist" id="picbox"><tr class="th"><td><strong>#</strong></td><td><strong>'.ROOT_NICKNAME.'</strong></td><td><strong>'.ROOT_EMAIL.'</strong></td><td><strong>'.ROOT_PHONE.'</strong></td><td><strong>'.ROOT_CUSTOMER_LEVEL.'</strong></td><td><strong>'.ROOT_USABLE_POINT.'</strong></td><td><strong>'.ROOT_TOTAL_POINT.'</strong></td><td><strong>钱包余额</strong></td><td><strong>'.ROOT_REGISTRATION_TIME.'</strong></td><td><strong>'.ROOT_LAST_LOGIN_TIME.'</strong></td><td><a href="'.$url.'.php?do=add" class="nada">[ '.ROOT_ADD.' ]</a></td></tr>';
	$count=1;
	foreach($result as $row )
	{
		$grade_id=$row['level'];
		$tem_grade=$arr_grade[$grade_id]['name_'.$lang];
		$id=decode($row['id']);
		$enable=$row['is_enabled']?ROOT_DISABLE:ROOT_ENABLE;
  		$str.="<tr ".(($row['is_enabled'])?"":"class=\"disabled\"")."><td>".$row['id'].".</td><td><a href=\"$url.php?cateid=$cateid&page=$page&id=".decode($row['id'])."\">".decode($row['nickname'])."</a></td><td>".decode($row['email'])."</td><td>".decode($row['phone'])."</td><td>".$tem_grade."</td><td>".decode($row['usable_point'])."</td><td>".decode($row['accumulated_point'])."</td><td>".decode($row['usable_balance']).' '.$currency_sign."</td><td>".decode($row['created_time'])."</td><td>".decode($row['last_login_time'])."</td><td>";
		$str.="<a href=\"$url.php?do=flip&cateid=$cateid&page=$page&id=".decode($row['id'])."\">".$enable."</a>";
		//$str.=" | <a href=\"$url.php?cateid=$cateid&page=$page&do=delete&id=".decode($row['id'])."\" onClick=\"return delc();\">".ROOT_DELETE."</a>";
		$str.="</td></tr>";
		//echo $str;
		$count++;
	}
	$str.= "</table>";
	if($count==1) { 
		$str.= "<br>".ROOT_NO_DATA."!";
	}
	echo $str;
	echo echo_page($page, $pages, $url.'-'.$cateid.'-p');
 } ?>
 <br class="clear" />
	</div> <!-- End .content-box-content -->
    <br class="clear" />
	</div><!-- End .content-box -->
</body>
</html>